home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug190 / as68.doc < prev    next >
Text File  |  1985-11-14  |  44KB  |  1,776 lines

  1.  
  2.  
  3.                        as68 - 68000 Assembler, version 1.01
  4.  
  5.  
  6.                (c) copyright 1982 Steve Passe  all rights reserved
  7.  
  8.  
  9.  
  10.  
  11.  
  12.                            Table of Contents
  13.  
  14.  
  15.           Chapter 1 Introduction                                 1
  16.  
  17.           Chapter 2 Usage                                        5
  18.  
  19.           Chapter 3 Pseudo-ops                                   9
  20.  
  21.           Chapter 4 Mnemonics                                    12
  22.  
  23.           Chapter 5 Expressions                                  15
  24.  
  25.           Chapter 6 S File Format                                17
  26.  
  27.           Chapter 7 Error Messages                               19
  28.  
  29.           Chapter 8 Differences                                  23
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.           as68 Manual                                     Introduction
  39.           
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.                                     Chapter 1
  50.  
  51.                                   Introduction
  52.  
  53.  
  54.  
  55.  
  56.             The  as68  assembler is a disk to disk assembler  for  the
  57.           Motorola  68000  micrprocessor  chip.   Written   in  the  c
  58.           programming language, it may be used as a cross assembler on
  59.           any  machine  supporting c, or  as  a  native  assembler  if
  60.           compiled  with  a  c  that   produces  68000  output.   It's
  61.           directives and mnemonic  set  closely  follow  that  of  the
  62.           Motorola Resident Structured Assembler.
  63.  
  64.           
  65.  
  66.           Source Program
  67.  
  68.             The  input  to  the  assembler  is  an  ascii  text  file,
  69.           consisting of a series of statements written in the assembly
  70.           language.  Each statement consists of  one  or  more  fields
  71.           within a line. 
  72.  
  73.             The assembler is free format within each line, i.e.  there
  74.           is  no  need  to  start a specific field of a statement in a
  75.           particular  column.   Fields are separated from one  another
  76.           with whitespace (tabs or spaces). 
  77.  
  78.           
  79.  
  80.           Statements
  81.  
  82.             There are 3 basic statement types.  The most common  is an
  83.           assembly language instruction or mnemonic. It is  a  command
  84.           to the  assembler  to  produce  a  machine operation code to
  85.           carry out a specific  action.   The second type of statement
  86.           is  called an assembly directive  or  pseudo-op.  Pseudo-ops
  87.           tell  the assembler how to assemble the program.  The  third
  88.           statement  type  is  called  a comment. It is ignored by the
  89.           assembler,  it's  purpose being to allow the  programmer  to
  90.           insert descriptions of what  the  code  is  doing within the
  91.           text of the source program.  Comments may exist as the final
  92.           field of the other two statement types. 
  93.  
  94.  
  95.  
  96.                                        -1-
  97.           
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.           as68 Manual                                     Introduction
  105.           
  106.  
  107.  
  108.  
  109.  
  110.           
  111.  
  112.           Instruction Statements
  113.  
  114.             An instruction statement  consists  of  from  one  to four
  115.           fields:
  116.  
  117.           
  118.  
  119.           [label] <mnemonic> [operand] [comment]
  120.  
  121.             Label Field
  122.  
  123.             The first field, the label field, is optional.  It is used
  124.           to  create  a  symbolic  name  for  the  address of the code
  125.           generated by  the  following assembler mnemonic.  This label
  126.           is  stored  in  the  symbol  table  and any references to it
  127.           evaluate to the associated address.  The label field  may be
  128.           the  only  field  of a statement and  multiple,  label  only
  129.           fields  may  follow one another.  In all cases the  label(s)
  130.           will  evaluate  to the address of the first mnemonic  to  be
  131.           assembled after the label(s) is specified. 
  132.  
  133.             Labels are composed of alphanumeric  characters and may be
  134.           up  to  30 characters long.  All characters of a  label  are
  135.           significant,  as  is the case of alphabetic characters (i.e.
  136.           "Foo" is different  than  "foo").  The  first character of a
  137.           label  must  be  either  alphabetic  or  the  character  '.'
  138.           (period).   Following   characters   may  also  include  the
  139.           underscore (_), dollarsign ($), and the digits '0' thru '9'.
  140.  
  141.             Labels starting in any other than the first column must be
  142.           terminated  with a colon (:). Certain symbols  are  reserved
  143.           for  the  use of the assembler and thus may not be  used  as
  144.           labels.   These  include  "SP",  "USP",  "SR",  "CCR",  "A0"
  145.           through "A7" and "D0" through "D7".
  146.  
  147.             Mnemonic Field
  148.  
  149.             The  second  field is the mnemonic or assembly instruction
  150.           field.  It will always be  present  in a statement except in
  151.           the  case  of a label only statement (label only  statements
  152.           might more properly be  described as assembler directives). 
  153.           If  the  line  is  unlabeled  the  mnemonic  field  must  be
  154.           preceeded by whitespace. 
  155.  
  156.             A  mnemonic  will consist of from 3 to 5 ascii characters,
  157.           the  case of  which  is  not  significant.   This  assembler
  158.           recognizes  the  standard  Motorola  instruction  set.   The
  159.  
  160.  
  161.  
  162.                                        -2-
  163.           
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.           as68 Manual                                     Introduction
  171.           
  172.  
  173.  
  174.  
  175.           complete mnemonic instruction set is described in chapter 4,
  176.           "Mnemonics". Many  68000  instructions may work on different
  177.           data sizes.  The desired data size is specified by appending
  178.           a length modifier or data size code to the mnemonic.  A '.b'
  179.           extension  specifies a data size of byte (8 bits) while '.l'
  180.           will cause the data size to be  a  long  word (32 bits).  No
  181.           extension will cause the data size to be a word  (16 bits). 
  182.           A  '.w'  extension  may  be used for  data  sizes  of  word,
  183.           although  this  size  is  the  default  and as such the '.w'
  184.           modifier is unnecessary. 
  185.  
  186.             Operand Field
  187.  
  188.             The operand field is necessary  only  for those statements
  189.           whose mnemonic requires  an operand(s).  It will contain one
  190.           or two operands.  When two operands are present they must be
  191.           separated  with  a  comma  (no  whitespace  allowed  between
  192.           operands).  The first of two  operands  is refered to as the
  193.           source operand while the second is the destination operand. 
  194.  
  195.             Comment Field
  196.  
  197.             The comment field is optional  and  consists  of  all text
  198.           following the above fields. 
  199.  
  200.           
  201.  
  202.           Directives
  203.  
  204.             Label Field
  205.  
  206.             Labels used  with  directive statements follow the general
  207.           rules   of  those  used  in  assembly  statements  with  one
  208.           important exception:    they  may  only  be  used  with  the
  209.           following directives:
  210.  
  211.             1.  EQU
  212.  
  213.             2.  SET
  214.  
  215.             3.  DC
  216.  
  217.             4.  DS
  218.  
  219.             5.  MACRO (unimplimented in ver.  1.xx)
  220.  
  221.             Directive Field
  222.  
  223.             The  directive  field  contains  an   instruction  to  the
  224.           assembler as to how the program should  be  assembled.  This
  225.  
  226.  
  227.  
  228.                                        -3-
  229.           
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.           as68 Manual                                     Introduction
  237.           
  238.  
  239.  
  240.  
  241.           includes such things as the base  address  of  the  program,
  242.           setting  of  symbol  values,  allocation of  program  memory
  243.           storage,  conditional  assembly,  etc.  The complete list of
  244.           available  assembly  directions   is  given  in  chapter  3,
  245.           "Pseudo-ops".
  246.  
  247.             Operand Field
  248.  
  249.             The operand field of a directive statement will consist of
  250.           zero  or  more  operands,  as  needed  by  the pseudo-op  in
  251.           question.  Multiple operands are separated with a comma (,).
  252.           No whitespace may exist between operands. 
  253.  
  254.             Comment Field
  255.  
  256.             The comment field is identical to that used in instruction
  257.           statements and is optional. 
  258.  
  259.           
  260.  
  261.           Comments
  262.  
  263.             Comments may exist alone as separate statements.   In such
  264.           cases an asterisk, (*), must be the  first  character on the
  265.           line. 
  266.  
  267.           
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.                                        -4-
  295.           
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.           as68 Manual                                            Usage
  303.           
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.                                     Chapter 2
  314.  
  315.                                       Usage
  316.  
  317.  
  318.  
  319.  
  320.           
  321.  
  322.           Cp/m
  323.  
  324.             The command line format is:
  325.  
  326.           
  327.  
  328.           as68 [sourcedisk:]<sourcefile>[.ext] [option[ option]]
  329.  
  330.           where:
  331.  
  332.           
  333.  
  334.           sourcedisk     is the optional disk specifier for the source
  335.                          program file.  If not  given  the source disk
  336.                          defaults to the logged in disk. 
  337.  
  338.           sourcefile     is the source file  name.   It  must meet all
  339.                          cp/m requirements for a legal file name. 
  340.  
  341.           ext              is  an   optional   cp/m   file   extension
  342.                          identifier.  By default the assembler expects
  343.                          source files to have an ext of ".sa".
  344.  
  345.           option          is  one  of  several   possible  options  in
  346.                          assembly.  Whitespace must  separate multiple
  347.                          options  when they occur.  Individual options
  348.                          are described below. 
  349.  
  350.           
  351.  
  352.           Options
  353.  
  354.             The following options are available:
  355.  
  356.           
  357.  
  358.  
  359.  
  360.                                        -5-
  361.           
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.           as68 Manual                                            Usage
  369.           
  370.  
  371.  
  372.  
  373.  
  374.             -  e, destination of error messages.  If absent all  error
  375.                messages  will  go  to  the  console  by  default.   If
  376.                present,  one or more of the following destinations may
  377.                be specified:
  378.  
  379.                  *  c, error messages to the console. 
  380.  
  381.                  *    e,   error   messages    to    a    file   named
  382.                     "sourcefile.err".  A disk specifier may follow the
  383.                     'e' option extension.   Otherwise the default disk
  384.                     is the source  file  disk.   For  example,  'eec:'
  385.                     would    send   error   messages   to   the   file
  386.                     "c:sourcefile.err".
  387.  
  388.                  *  f, errors reported in listing. 
  389.  
  390.                  *  l, error messages to the cp/m list device. 
  391.  
  392.             -   l,  destination  of  assembly listing.  If  absent  no
  393.                listing  is  made.  One or more of the following option
  394.                extensions are available:
  395.  
  396.                  *  c, listing to console. 
  397.  
  398.                  *  f, listing to a cp/m file.  The file will be named
  399.                     "sourcefile.ls" and will reside  on  the same disk
  400.                     as  the  source   file   unless  overridden  by  a
  401.                     following disk identifier.  For example,  to place
  402.                     the listing on both the console and  the  b  disk,
  403.                     use 'lcfb:'.
  404.  
  405.                  *  l, listing to cp/m list device. 
  406.  
  407.             -  o, type and destination of object file.  If not present
  408.                the object file will be in Motorola 'S' FILE format and
  409.                will be placed on the same disk as the source file. 
  410.  
  411.                  *  s, object to a  cp/m file.  The file will be named
  412.                     "sourcefile.mx",  the  output   file  will  be  in
  413.                     Motorola's 'S' FILE format.  A disk designator may
  414.                     follow the 's'  option  (i.e.  'osd:'),  specifing
  415.                     that the output file should  go  to other than the
  416.                     sourcefile disk (in the above  example it would go
  417.                     to drive d). 
  418.  
  419.                  *  x, no object file to be made. 
  420.  
  421.                s,  set  the  symbol  table  size.   The  symbol  table
  422.                requires 8 bytes plus the length of the symbol for each
  423.  
  424.  
  425.  
  426.                                        -6-
  427.           
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.           as68 Manual                                            Usage
  435.           
  436.  
  437.  
  438.  
  439.                entry.  The argument should be  in  decimal bytes.  The
  440.                symbol  table  defaults  to  2000 bytes  (decimal).  To
  441.                reserve 3500 bytes the option would be: 's3500'.
  442.  
  443.             -  t, truncate source code lines  in listing.  This option
  444.                will cause the source code lines sent to any  open list
  445.                channel  to  be truncated at the normal  wrap  position
  446.                (see  option  'w'  below).  It defaults to being off, a
  447.                't' in the command line will turn it on. 
  448.  
  449.             -  w,  set  the  value  of wrap.  Source code lines in the
  450.                listing(s) will normally be 'wrapped' to the  next line
  451.                if  they  extend  beyond the column number specified by
  452.                this option.  If  the  't' option is active this option
  453.                specifies  the column beyond  which  source  lines  are
  454.                truncated.  The default value of 'w' is  80, but can be
  455.                set  between  60 and any reasonable number of columns. 
  456.                Note  that  this  number  should be set to the width of
  457.                your list device, it is  not  the  number of columns of
  458.                source code to a  line  (i.e.  a  value of 80 allows 40
  459.                characters  of source per line after accounting for the
  460.                40 columns used by the line/loc/code fields). 
  461.  
  462.           
  463.  
  464.           Examples
  465.  
  466.           
  467.  
  468.             -  as68 foo lf ecf<cr> would assemble foo.sa and create:
  469.  
  470.                  *  foo.ls, the listing file. 
  471.  
  472.                  *   foo.err,  the  error file (as well as send  error
  473.                     messages to the console and the listing file). 
  474.  
  475.                  *  foo.ro, the s file object (by default). 
  476.  
  477.             This would be the normal assembly invocation. 
  478.  
  479.             -  as68 bar ox ecfb:<cr> would assemble bar.sa and create:
  480.  
  481.                  *  b:bar.err, the error file  on  drive  b: (and send
  482.                     error messages to console). 
  483.  
  484.             No object or list would  be created.  This method would be
  485.                used  during  assemblies  that  one knows will generate
  486.                some errors.  Since  the  source comes from a: and only
  487.                one file is created, on  b:,  the  disk  access time is
  488.                minimized  and sufficient information is placed in  the
  489.  
  490.  
  491.  
  492.                                        -7-
  493.           
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.           as68 Manual                                            Usage
  501.           
  502.  
  503.  
  504.  
  505.                error  file  to  allow correction of the  source.   The
  506.                error file will be much smaller than  a  list file with
  507.                errors  and  thus  will  be  quicker  to  write  during
  508.                assembly  and  easier  to  scan  during  correction  of
  509.                source. 
  510.  
  511.           
  512.  
  513.           Other Systems
  514.  
  515.             The  code  presently  supports  only  the  cp/m  operating
  516.           system.  Some work would have to be done in the command line
  517.           parser to bring it up on other operating systems. 
  518.  
  519.           
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.                                        -8-
  559.           
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.           as68 Manual                                       Pseudo-ops
  567.           
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.                                     Chapter 3
  578.  
  579.                                    Pseudo-ops
  580.  
  581.  
  582.  
  583.  
  584.           
  585.  
  586.           Assembly Control
  587.  
  588.             The following assembler directives are used to control the
  589.           assembly:
  590.  
  591.           
  592.  
  593.           ORG            is used to specify the absolute memory origin
  594.                          of the code to be  assembled.  The operand is
  595.                          an  expression  that  evaluates to an address
  596.                          within the first 64 kilobytes of memory space
  597.                          (0 thru $FFFF). Any memory references outside
  598.                          this range will cause an assembly  error.  Be
  599.                          aware  that  the   68000  chip  sign  extends
  600.                          absolute  short  addresses.    Thus   address
  601.                          references  above  32k  ($8000)  will  access
  602.                          hardware memory in  the range of $FF8000 thru
  603.                          $FFFFFF.  This  pseudo-op   will   cause  the
  604.                          assembler  to  generate  code  using absolute
  605.                          short addressing.
  606.  
  607.           ORG.L          is also used to  specify  the absolute memory
  608.                          origin.  However, in  this  case  the  entire
  609.                          address range of the 68000 is usable  (0 thru
  610.                          $FFFFFF). The assembler  will  generate  code
  611.                          using absolute long addressing. 
  612.  
  613.           RORG            causes  the  assembler to  generate  program
  614.                          counter  relative  code.   The  memory  range
  615.                          restrictions of the "ORG" directive apply. 
  616.  
  617.           RORG.L          causes  the  assembler  to  generate program
  618.                          counter relative code  as  above, however the
  619.                          expression in the  operand field may evaluate
  620.                          to  any  value  within  the  68000's  address
  621.  
  622.  
  623.  
  624.                                        -9-
  625.           
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.           as68 Manual                                       Pseudo-ops
  633.           
  634.  
  635.  
  636.  
  637.                          range. 
  638.  
  639.           END             signals  the  end  of  the assembly language
  640.                          program. 
  641.  
  642.           
  643.  
  644.           Symbol Definition
  645.  
  646.             The  following  directives   control   the  definition  of
  647.           symbols:
  648.  
  649.           
  650.  
  651.           EQU            defines a symbol and sets it's  value to that
  652.                          of  the  operand.   This  symbol   value   is
  653.                          permanent,  i.e.   it cannot be changed later
  654.                          in a program.   The  operand may be a complex
  655.                          expression    but    cannot    make   forward
  656.                          references. 
  657.  
  658.           SET            defines or redefines a symbol and  sets  it's
  659.                          value to that  of  the operand.  The value is
  660.                          temporary and may be reset with another 'SET'
  661.                          directive.  Again, forward references are not
  662.                          allowed. 
  663.  
  664.           
  665.  
  666.           Memory Allocation
  667.  
  668.             These directives are  used  to  reserve  and/or initialize
  669.           memory:
  670.  
  671.           
  672.  
  673.           DC               fills   memory  locations   with   constant
  674.                          value(s).    An  extension  of  '.B'   causes
  675.                          individual  bytes to be filled with the value
  676.                          of the operand(s).  An extension of '.L' will
  677.                          cause  the operands to be evaluated as 32 bit
  678.                          values, which are placed in  4  byte  blocks,
  679.                          one for each  operand.   No extension or '.W'
  680.                          signifies  that  the  operand(s)  are  to  be
  681.                          evaluated as 16 bit values, each being stored
  682.                          in  consecutive  2  byte locations.  Word and
  683.                          long word values are  aligned on even address
  684.                          boundries.    DC.B   directives  causing  the
  685.                          location  counter  to  end  on an odd address
  686.                          will pad  1 byte with a zero value unless the
  687.  
  688.  
  689.  
  690.                                       -10-
  691.           
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.           as68 Manual                                       Pseudo-ops
  699.           
  700.  
  701.  
  702.  
  703.                          next source statement is another DC.B.
  704.  
  705.           DS             reserves memory  locations.   Again,  a  data
  706.                          size extension  may  be  appended  to 'DS' to
  707.                          specify either byte or long word allocation. 
  708.                          The  operand specifies  the  number  of  data
  709.                          cells to reserve, i.e.   if the extension was
  710.                          '.L' and the operand evaluated to 5, forty (5
  711.                          * 4  bytes  for  a  long word) bytes would be
  712.                          reserved.  Word alignment is not automatic as
  713.                          in  the  dc  directive.  To  force  alignment
  714.                          after  a  DS.B  statement  use   a   "ds   0"
  715.                          statement. 
  716.  
  717.           
  718.  
  719.           List Controls
  720.  
  721.             These directives are used to control the listing output:
  722.  
  723.           
  724.  
  725.           LIST           causes listing  output  (if  enabled from the
  726.                          command line) to be sent to  each of the open
  727.                          list channels.  LIST is active by default and
  728.                          remains   so   until  a  NOLIST   pseudo   is
  729.                          encountered. 
  730.  
  731.           NOLIST         causes listing output to be turned  off until
  732.                          a LIST pseudo is encountered. 
  733.  
  734.           
  735.  
  736.           Macro Commands
  737.  
  738.             Macro commands are not implimented in version 1.xx of this
  739.           assembler. 
  740.  
  741.           
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.                                       -11-
  757.           
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.           as68 Manual                                        Mnemonics
  765.           
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.                                     Chapter 4
  776.  
  777.                                     Mnemonics
  778.  
  779.  
  780.  
  781.  
  782.             The mnemonics used by this assembler follow  the  standard
  783.           mnemonic instruction set as defined  by  Motorola. Mnemonics
  784.           may exist in  either upper or lower case in the source file,
  785.           the assembler makes no distinctions. 
  786.  
  787.           
  788.  
  789.           ABCD           add binary coded decimal
  790.  
  791.           ADD            add binary
  792.  
  793.           ADDQ           add quick binary,  operand in range of 1 thru
  794.                          8
  795.  
  796.           ADDX           add binary with extend
  797.  
  798.           AND            logical and
  799.  
  800.           ASL            arithmetic shift left
  801.  
  802.           ASR            arithmetic shift right
  803.  
  804.           Bcc            branch conditionally
  805.  
  806.           BCHG           bit test and change
  807.  
  808.           BCLR           bit test and clear
  809.  
  810.           BRA            branch unconditional
  811.  
  812.           BSET           bit test and set
  813.  
  814.           BSR            branch to subroutine
  815.  
  816.           BTST           bit test
  817.  
  818.           CHK            check register against boundaries
  819.  
  820.  
  821.  
  822.                                       -12-
  823.           
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.           as68 Manual                                        Mnemonics
  831.           
  832.  
  833.  
  834.  
  835.  
  836.           CLR            clear operand
  837.  
  838.           CMP            compare
  839.  
  840.           CMPM           compare memory
  841.  
  842.           DBcc           test condition, decrement and branch
  843.  
  844.           DIVS           signed divide
  845.  
  846.           DIVU           unsigned divide
  847.  
  848.           EOR            exclusive or
  849.  
  850.           EXG            exchange registers
  851.  
  852.           EXT            sign extend
  853.  
  854.           JMP            jump to address
  855.  
  856.           JSR            jump to subroutine
  857.  
  858.           LEA            load effective address
  859.  
  860.           LINK           link and allocate
  861.  
  862.           LSL            logical shift left
  863.  
  864.           LSR            logical shift right
  865.  
  866.           MOVE           move
  867.  
  868.           MOVEM          move multiple registers
  869.  
  870.           MOVEP          move peripheral data
  871.  
  872.           MOVEQ          move quick, operand in range og -128 thru 127
  873.  
  874.           MULS           signed multiply
  875.  
  876.           MULU           unsigned multiply
  877.  
  878.           NBCD           negate binary coded decimal
  879.  
  880.           NEG            negate
  881.  
  882.           NEGX           negate with extend
  883.  
  884.           NOP            no operation
  885.  
  886.  
  887.  
  888.                                       -13-
  889.           
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.           as68 Manual                                        Mnemonics
  897.           
  898.  
  899.  
  900.  
  901.  
  902.           NOT            bitwise compliment
  903.  
  904.           OR             logical or
  905.  
  906.           PEA            push effective address
  907.  
  908.           RESET          reset external devices
  909.  
  910.           ROL            rotate left
  911.  
  912.           ROR            rotate right
  913.  
  914.           ROXL           rotate left with extend
  915.  
  916.           ROXR           rotate right with extend
  917.  
  918.           RTE            return from exception
  919.  
  920.           RTR            return and restore condition codes
  921.  
  922.           RTS            return from subroutine
  923.  
  924.           SBCD           subtract binary coded decimal
  925.  
  926.           Scc            set conditional
  927.  
  928.           STOP           stop
  929.  
  930.           SUB            subtract binary
  931.  
  932.           SUBQ           subtract quick binary, operand in range  of 1
  933.                          thru 8
  934.  
  935.           SUBX           subtract binary with extend
  936.  
  937.           SWAP           swap register halves
  938.  
  939.           TAS            test and set operand
  940.  
  941.           TRAP           trap
  942.  
  943.           TRAPV          trap on overflow
  944.  
  945.           TST            test an operand
  946.  
  947.           UNLK           unlink
  948.  
  949.           
  950.  
  951.  
  952.  
  953.  
  954.                                       -14-
  955.           
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.           as68 Manual                                      Expressions
  963.           
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.                                     Chapter 5
  974.  
  975.                                    Expressions
  976.  
  977.  
  978.  
  979.  
  980.           
  981.  
  982.           Expressions
  983.  
  984.             Expressions consist of one or  more  symbols  combined  by
  985.           binary and/or unary (algebraic) operators.  Possible symbols
  986.           include:
  987.  
  988.           
  989.  
  990.             -  Symbols defined with the EQU and SET directives.
  991.  
  992.             -  Program labels.
  993.  
  994.             -  Numeric values.
  995.  
  996.             -  The asterisk, ('*'), which equates to the present value
  997.                of the program location counter.
  998.  
  999.             Algebraic Operators include:
  1000.  
  1001.           
  1002.  
  1003.             -  arithmetic operators:
  1004.  
  1005.                  *  multiplication: '*'
  1006.  
  1007.                  *  division: '/'
  1008.  
  1009.                  *  addition: '+'
  1010.  
  1011.                  *  subtraction: '-'
  1012.  
  1013.             logical operators:
  1014.  
  1015.                  *  logical (bitwise) AND: '&'
  1016.  
  1017.  
  1018.  
  1019.  
  1020.                                       -15-
  1021.           
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.           as68 Manual                                      Expressions
  1029.           
  1030.  
  1031.  
  1032.  
  1033.                  *  logical (bitwise) OR: '!'
  1034.  
  1035.                  *  left shift: '<<'
  1036.  
  1037.                  *  right shift: '>>'
  1038.  
  1039.             unary operators:
  1040.  
  1041.                  *  unary minus: '-'
  1042.  
  1043.                  *  location counter value: '*'
  1044.  
  1045.           
  1046.  
  1047.           Symbols
  1048.  
  1049.             Symbols are composed of alphanumeric characters and may be
  1050.           up to 30  characters  long.   All  characters of a label are
  1051.           significant,  as  is the case of alphabetic characters (i.e.
  1052.           "Foo" is different  than  "foo").  The  first character of a
  1053.           label  must  be  either  alphabetic  or  the  character  '.'
  1054.           (period).   Following   characters   may  also  include  the
  1055.           underscore (_), dollarsign ($), and the digits '0' thru '9'.
  1056.  
  1057.             Numbers may be represented as either decimal, hexadecimal,
  1058.           or binary:
  1059.  
  1060.           
  1061.  
  1062.             -   decimal  numbers are represented by the  normal  ascii
  1063.                digits '0' thru '9'.
  1064.  
  1065.             -  hexadecimal numbers  start  with  a  dollar  sign ('$')
  1066.                followed by the ascii digits '0' thru '9' and the ascii
  1067.                characters 'A' thru 'F'.
  1068.  
  1069.             -  binary numbers start with a percent sign ('%') followed
  1070.                by the ascii digits '0' and '1'.
  1071.  
  1072.           
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.                                       -16-
  1087.           
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.           as68 Manual                                    S File Format
  1095.           
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.                                     Chapter 6
  1106.  
  1107.                                   S File Format
  1108.  
  1109.  
  1110.  
  1111.  
  1112.             A  Motorola  "S  file" is similar in structure to an Intel
  1113.           hex file.  It consists of a series of ascii records, each in
  1114.           the following format:
  1115.  
  1116.           
  1117.  
  1118.             -   The  record start character, an uppercase  ascii  'S',
  1119.                followed by an ascii numeral, '0' thru '9':
  1120.  
  1121.             -
  1122.  
  1123.                  *  a '0' for the file header record. 
  1124.  
  1125.                  *  a '1' for records with short (16 bit) addresses. 
  1126.  
  1127.                  *  a '2' for records with medium (24 bit) addresses. 
  1128.  
  1129.                  *  a '3' for records with long (32 bit) addresses. 
  1130.  
  1131.                  *  ......
  1132.  
  1133.                  *  a '9' for the tail record. 
  1134.  
  1135.             -   The  third  and  forth  bytes  forming  an  ascii  hex
  1136.                representation  of  the number of bytes in the body  of
  1137.                the record:
  1138.  
  1139.                  *   an address field consisting of 4, 6, or  8  ascii
  1140.                     bytes representing the load address of  the record
  1141.                     (record types S1, S2, S3, respectively). 
  1142.  
  1143.             -  The body of the record consists  of  up  to 16 bytes of
  1144.                data, each byte represented as 2 ascii hex bytes. 
  1145.  
  1146.             -   A  checksum  byte,  again  represented  by  two  ascii
  1147.                characters:
  1148.  
  1149.  
  1150.  
  1151.  
  1152.                                       -17-
  1153.           
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.           as68 Manual                                    S File Format
  1161.           
  1162.  
  1163.  
  1164.  
  1165.             -
  1166.  
  1167.                  *  The checksum for each record (except the last, S9)
  1168.                     is   the   least  significant  byte  of  the   1's
  1169.                     compliment of the sum of the byte  values  of  the
  1170.                     count,  address, and data fields.  (ie, everything
  1171.                     in the record except 'Sx').
  1172.  
  1173.                  *    The   checksum   on    the    'S9'   record   is
  1174.                     undefined/non-existant. 
  1175.  
  1176.           
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.                                       -18-
  1219.           
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.           as68 Manual                                   Error Messages
  1227.           
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.                                     Chapter 7
  1238.  
  1239.                                  Error Messages
  1240.  
  1241.  
  1242.  
  1243.  
  1244.           
  1245.  
  1246.             -   1:  statement  parsing  error.  The occurrance of this
  1247.                error indicates that  the  line  totally  confuses  the
  1248.                parser and no  further  diagnostic comments (legitimate
  1249.                comments anyway) can be made. 
  1250.  
  1251.             -  2: bad character in  mnemonic-psdo  field.   An illegal
  1252.                character exists in the word  present  in  the mnenonic
  1253.                field,  see   chapter   1,   introduction,  instruction
  1254.                statements. 
  1255.  
  1256.             -  3: instruction or pseudo not  found  in tables.  Unless
  1257.                error  2 is also generated  the  instr/pseudo  word  is
  1258.                properly formed (i.e. no illegal characters are  in it)
  1259.                but not a recognized instruction. 
  1260.  
  1261.             -  4: bad character in macro field.  Version 1.xx does not
  1262.                recognize macros! 
  1263.  
  1264.             -   5:  macro not found in macro table(s).  Again,  macros
  1265.                are not yet recognized. 
  1266.  
  1267.             -   6: improper use of label.  Most often this error flags
  1268.                the use of a label on a pseudo op  line  that  does not
  1269.                allow  the use of labels.  See chapter 1, introduction,
  1270.                directives:label field. 
  1271.  
  1272.             -   7:  can't  evaluate  operand.   The  assembler  cannot
  1273.                evaluate the value of an operand.   This  may be caused
  1274.                by  a variety  of  reasons  such  as  imbedded  spaces,
  1275.                unrecognized operators, unbalanced  parenthesis,  etc. 
  1276.                Additional  errors  will  usually be reported that will
  1277.                help clarify the problem. 
  1278.  
  1279.             -   8: can't evaluate equ operand.  As above, generated in
  1280.                the case of an EQU statement. 
  1281.  
  1282.  
  1283.  
  1284.                                       -19-
  1285.           
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.           as68 Manual                                   Error Messages
  1293.           
  1294.  
  1295.  
  1296.  
  1297.  
  1298.             -  9: can't evaluate set operand.  As above, generated  in
  1299.                the case of an SET statement. 
  1300.  
  1301.             -  10: attempt to redefine a permanent symbol.  The symbol
  1302.                was  previously  defined  via an EQU statement and thus
  1303.                cannot be changed. 
  1304.  
  1305.             -  11: symbol table full.  This is a  fatal error and will
  1306.                cause the assembly to abort.  You may try again setting
  1307.                an optional symbol table size  from  the command line. 
  1308.                See chapter 2, usage, options:s. 
  1309.  
  1310.             -   12:  unrecognized  operand.  A legal operand cannot be
  1311.                formed from the data in the operand field. 
  1312.  
  1313.             -  13: symbol not defined in symbol table.  The symbol was
  1314.                not  encountered  in  the  program up to  this  point. 
  1315.                Remember that forward references are not allowed in EQU
  1316.                and SET pseudo statements. 
  1317.  
  1318.             -  14: label out  of  range  for current addressing mode. 
  1319.                The value of the label is outside  the  limits  of  the
  1320.                current  statement.   This  usually is  an  attempt  to
  1321.                reference an address beyond the 32k bytes range imposed
  1322.                in  the  short  addressing  mode.    See   chapter   3,
  1323.                pseudo-ops, assembly control. 
  1324.  
  1325.             -  15: operand  1  is not valid for instruction type.  The
  1326.                first operand encountered is not  a  valid  operand for
  1327.                this particular instruction/addressing mode. 
  1328.  
  1329.             -   16:  operand 2 is not valid for instruction type.  The
  1330.                second operand encountered is not a valid  operand  for
  1331.                this particular instruction/addressing mode. 
  1332.  
  1333.             -  17: operand 1 is not correctly  formed.   This  may  be
  1334.                caused  by illegal use of operators, undefined  labels,
  1335.                etc.  The assembler may  or may not attempt to evaluate
  1336.                the  second  operand.  If it does you are  not  assured
  1337.                that it will do so correctly.  For  more  on  this  see
  1338.                error #18.
  1339.  
  1340.             -  18: operand 2 is not correctly formed.  This may be for
  1341.                any of  the reasons stated above for error 17. Remember
  1342.                that it could  be incorrectly evaluated if error 17 was
  1343.                also generated and  that  the  second  operand  may  be
  1344.                incorrectly formed but not reported as such after error
  1345.                17  occurs.   This  is  dependant   on   the  assembler
  1346.                correctly determining where the poorly formed operand 1
  1347.  
  1348.  
  1349.  
  1350.                                       -20-
  1351.           
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.           as68 Manual                                   Error Messages
  1359.           
  1360.  
  1361.  
  1362.  
  1363.                ends and operand 2 starts. 
  1364.  
  1365.             -  19: code  building  function  failed.   The binary code
  1366.                building function has  failed  to  properly construct a
  1367.                sequence  of  code  for the statement.  Thie error will
  1368.                usually   be   followed   with  additional   error   #s
  1369.                pinpointing the problem. 
  1370.  
  1371.             -  20: 3 bit immediate data value out of  bounds, i.e.  it
  1372.                is greater than 7 or less than 0.
  1373.  
  1374.             -  21: 8 bit bit field specifier out of range. 
  1375.  
  1376.             -  22: 32 bit bit field specifier out of range. 
  1377.  
  1378.             -  23: attempt to generate a bit field specifier failed. 
  1379.  
  1380.             -  24: count operand out of range (1-8).
  1381.  
  1382.             -   25: destination register specifier illegal or  out  of
  1383.                range. 
  1384.  
  1385.             -  26: source or destination register specifier illegal or
  1386.                out of range. 
  1387.  
  1388.             -  27: attempt  to generat register mask list from operand
  1389.                failed. 
  1390.  
  1391.             -   28:  operand  failed to evaluate to a proper source or
  1392.                destination effective address. 
  1393.  
  1394.             -   29:  illegal destination effective  address,  probably
  1395.                label or label with index reference. 
  1396.  
  1397.             -  30: illegal destination effective address. 
  1398.  
  1399.             -   31:  illegal  multiple  destination effective address,
  1400.                either label,  label  with  index,  or address register
  1401.                indirect with predecrement or postincrement. 
  1402.  
  1403.             -   32: illegal jump effective  address,  usually  address
  1404.                register indirect with predecrement or postincrement. 
  1405.  
  1406.             -  33: 4 bit vector out of range. 
  1407.  
  1408.             -   34: expected address displacement failed  to  evaluate
  1409.                correctly. 
  1410.  
  1411.             -  35: 8 bit displacement out of range (-128 thru 127)
  1412.  
  1413.  
  1414.  
  1415.  
  1416.                                       -21-
  1417.           
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.           as68 Manual                                   Error Messages
  1425.           
  1426.  
  1427.  
  1428.  
  1429.             -  36: 16  bit  displacement  out  of  range  (-32768 thru
  1430.                32766)
  1431.  
  1432.             -   37:  extent   word   of  operand  failed  to  evaluate
  1433.                correctly. 
  1434.  
  1435.             -  38: 8 bit operand out of range (-128  thru 255, sign is
  1436.                responsibility of programmer). 
  1437.  
  1438.             -  39: 8 bit extension word value out of  range (-128 thru
  1439.                255).
  1440.  
  1441.             -   40:  16  bit  extension word out of range (-32768 thru
  1442.                65535).
  1443.  
  1444.             -   41:  32  bit  extension  word  value   out   of  range
  1445.                (overflow).
  1446.  
  1447.             -  42: attempt to generate a  16  bit displacement failed,
  1448.                probably out of range. 
  1449.  
  1450.             -  43: attempt to generate an 8  bit  displacemnt  failed,
  1451.                check range. 
  1452.  
  1453.           
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.                                       -22-
  1483.           
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.           as68 Manual                                      Differences
  1491.           
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.                                     Chapter 8
  1502.  
  1503.                                    Differences
  1504.  
  1505.  
  1506.  
  1507.  
  1508.             This list  must be considered incomplete and will be added
  1509.           to as the facts are brought to my attention. 
  1510.  
  1511.           
  1512.  
  1513.           In General
  1514.  
  1515.           
  1516.  
  1517.             -   As68 allows addresses assembled  under  an  rorg.l  or
  1518.                org.l condition to be coerced  into  a short address by
  1519.                enclosing the entire expression in a set of parenthesis
  1520.                followed  by  '.s'.  This  allows  references  to   the
  1521.                first/last 32k  with  a  code  sequence that is 2 bytes
  1522.                shorter than the long address mode.  As an example:
  1523.  
  1524.  
  1525.  
  1526.                        org.l   $8000
  1527.  
  1528.                outport equ     $ffa000         * port mapped into last
  1529.                                                * page of address space
  1530.  
  1531.                        move.b  d0,outport      * will generate 6 bytes of
  1532.                            * code, while
  1533.                        move.b  d0,(outport).s  * will only generate 4 bytes
  1534.                            * of code
  1535.           
  1536.  
  1537.           Motorola Resident Structured Assembler
  1538.  
  1539.           
  1540.  
  1541.             -  Motorola allows forward short  branch  instructions  to
  1542.                default  to  either  long or  short  addressing.   as68
  1543.                always  uses  long  or  short  addressing,  forward  or
  1544.                backward,   dependant  on  the  presence  of  the  '.s'
  1545.                modifier  on the mnemonic.  Motorola will determine the
  1546.  
  1547.  
  1548.  
  1549.                                       -23-
  1550.           
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.           as68 Manual                                      Differences
  1558.           
  1559.  
  1560.  
  1561.  
  1562.                necessary   value  (short  or  long)  automatically  on
  1563.                backward references. 
  1564.  
  1565.             -  The value shown in  listings  for the DS pseudo-op will
  1566.                reflect the number  of  bytes  reserved in the Motorola
  1567.                listing while the as68 listing  will  report the number
  1568.                of  elements  reserved.  For example the line:  ds.w  2
  1569.                will have a value of 0002 in the as68 listing while the
  1570.                Motorola listing will report a value of 0004
  1571.  
  1572.           
  1573.  
  1574.           Digital Research Assembler
  1575.  
  1576.           
  1577.  
  1578.             -  Pseudo-ops are required to  start  with a period (.) by
  1579.                the Digital assembler while  as68  follows the Motorola
  1580.                conventions. 
  1581.  
  1582.             -  Digital expects a default source file extention of ".s"
  1583.                where as68 expects ".sa"
  1584.  
  1585.           
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.                                       -24-
  1616.           
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.           as68 Manual                                      Differences
  1624.           
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.                                       -25-
  1682.           
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.                                       Index
  1697.  
  1698.  
  1699.           !  15
  1700.           &  15
  1701.           *  16
  1702.           .b extension  3, 10
  1703.           .l extension  3, 10
  1704.           .w extension  3, 10
  1705.           <<  16
  1706.           >>  16
  1707.           absolute long addressing  9
  1708.           absolute short addressing  9
  1709.           AND  15
  1710.           arithmetic operators  15
  1711.           assembly control  9
  1712.           assembly options  5
  1713.           binary  16
  1714.           comment  3, 4, 4
  1715.           cp/m  5
  1716.           data size code  3
  1717.           datasize code  10
  1718.           DC  3, 10
  1719.           decimal  16
  1720.           destination operand  3
  1721.           Digital Research Assembler  24
  1722.           directive  3, 3
  1723.           DS  3, 11
  1724.           END  10
  1725.           EQU  3, 10
  1726.           expression  15
  1727.           hexadecimal  16
  1728.           instruction  2
  1729.           label  2, 3, 15
  1730.           left shift  16
  1731.           LIST  11
  1732.           list controls  11
  1733.           location counter  15, 16
  1734.           logical operators  15
  1735.           MACRO  3, 11
  1736.           macro commands  11
  1737.           memory allocation  10
  1738.           mnemonic  2
  1739.           mnemonics  12
  1740.           Motorola 'S' FILE  6
  1741.           Motorola Resident Structured Assembler  23
  1742.           NOLIST  11
  1743.           numbers  15, 16
  1744.           operand  3, 4
  1745.           operators  15
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.           OR  15
  1759.           ORG  9
  1760.           ORG.L  9
  1761.           program counter relative  9
  1762.           right shift  16
  1763.           RORG  9
  1764.           RORG.L  9
  1765.           S file  17
  1766.           SET  3, 10
  1767.           source operand  3
  1768.           source program  1
  1769.           statement  1
  1770.           symbol  15, 16
  1771.           symbol definition  10
  1772.           unary minus  16
  1773.           unary operators  16
  1774. 
  1775.           EQU  3, 10
  1776.